<form class="layui-form layui-form-pane" method="post" action="" enctype="multipart/form-data" >
    @csrf
    <input type="hidden" name="id" value="{{$res['id']}}">
    <div class="layui-form-item">
        <label class="layui-form-label">账号</label>
        <div class="layui-input-inline" style="width:80%;">
            <input type="text" name="user" value="{{$res['user']}}" required  lay-verify="required" readonly autocomplete="off" class="layui-input" >
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">重置密码</label>
        <div class="layui-input-inline" style="width:30%;">
            <input type="password" name="password" value='' lay-verify="" placeholder='输入密码' autocomplete="off" class="layui-input" >
        </div>
        <div class="layui-form-mid layui-word-aux">如不重置,请勿填写</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">重置操作密码</label>
        <div class="layui-input-inline" style="width:30%;">
            <input type="password" name="check_pass" value='' lay-verify="" placeholder='输入操作密码' autocomplete="off" class="layui-input" >
        </div>
        <div class="layui-form-mid layui-word-aux">如不重置,请勿填写</div>
    </div>
    <div class="layui-form-item" >
        <label class="layui-form-label">角色</label>
        <div class="layui-input-block">
            @if($roleList->isEmpty())
                <div class="layui-form-mid layui-word-aux">无角色可选</div>
            @else
                @foreach ($roleList as $v)
                    <input type="checkbox" name="role[]" title="{{$v['name']}}" value="{{$v['id']}}" @if(in_array($v['id'],$roles)) checked @endif >
                @endforeach
            @endif
        </div>
    </div>
    <div class="layui-form-item" >
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;
        form.render();
        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.confirm('确认执行此操作？', {icon: 3, title:'提示'}, function(index){
                ajax("{{url('admin/admin/update')}}",data.field,function(data){
                    layer.close();
                    layer.closeAll();
                    layer.msg(data.msg);
                    if(data.code == 1){
                        location.href = location.href;
                    }
                });
            });
            return false;
        });
    });
</script>
